<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm" >
						<div class="form-group">
							<label class="col-sm-3 control-label">主键编号：</label>
							<div class="col-sm-8">
								<input id="id" name="id" class="form-control" readonly type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">小程序appid：</label>
							<div class="col-sm-8">
								<input id="appid" name="appid" class="form-control" readonly type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">广告ID(预留字段)：</label>
							<div class="col-sm-8">
								<input id="adId" name="adId" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">广告位置(预留字段)：</label>
							<div class="col-sm-8">
								<input id="adPosition" name="adPosition" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Banner 广告ID：</label>
							<div class="col-sm-8">
								<input id="bannerid" name="bannerid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">插屏广告ID：</label>
							<div class="col-sm-8">
								<input id="interstitialid" name="interstitialid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">视频广告ID：</label>
							<div class="col-sm-8">
								<input id="videoid" name="videoid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Grid 广告,格子广告-使用原生模板代替：</label>
							<div class="col-sm-8">
								<input id="gridid" name="gridid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">激励视频广告ID：</label>
							<div class="col-sm-8">
								<input id="rewardedVideoid" name="rewardedVideoid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">原生模板广告Aid：</label>
							<div class="col-sm-8">
								<input id="customAid" name="customAid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">原生模板广告Bid：</label>
							<div class="col-sm-8">
								<input id="customBid" name="customBid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">原生模板广告Cid：</label>
							<div class="col-sm-8">
								<input id="customCid" name="customCid" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">广告标识：1banner、2视频、3格子、4原生A、5原生B   例如：4,5,1,3：</label>
							<div class="col-sm-8">
								<input id="posisionad" name="posisionad" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">暴力插屏广告模式：</label>
							<div class="col-sm-8">
								<select id="switchInad" name="switchInad" class="form-control">
									<option value="no">关闭</option>
									<option value="yes">开启</option>
								</select>
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button class="btn btn-primary" onclick="update()">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>



<script type="text/javascript">

	getData();
	function getData() {
		$.ajax({
			cache : true,
			type : "get",
			url : ctxPath+ "/wallpaper/wxAdvert/get",
			async : false,
			error : function(request) {
			},
			success : function(data) {
				let wxAdvert = data.wxAdvert;
				if (data.code == 0 && wxAdvert != null) {

					$("#id").val(data.wxAdvert.id);
					$("#appid").val(data.wxAdvert.appid);
					$("#adId").val(wxAdvert.adId);
					$("#adPosition").val(wxAdvert.adPosition);
					$("#bannerid").val(wxAdvert.bannerid);
					$("#interstitialid").val(wxAdvert.interstitialid);
					$("#videoid").val(wxAdvert.videoid);
					$("#gridid").val(wxAdvert.gridid);
					$("#rewardedVideoid").val(wxAdvert.rewardedVideoid);
					$("#customAid").val(wxAdvert.customAid);
					$("#customBid").val(wxAdvert.customBid);
					$("#customCid").val(wxAdvert.customCid);
					$("#posisionad").val(wxAdvert.posisionad);
					$("#switchInad").val(wxAdvert.switchInad);
				}

			}
		});
	}


	function update() {
		$.ajax({
			cache : true,
			type : "POST",
			url : ctxPath+ "/wallpaper/wxAdvert/update",
			data : $('#signupForm').serialize(),// 你的formid
			async : false,
			error : function(request) {
				parent.layer.alert("Connection error");
			},
			success : function(data) {
				if (data.code == 0) {
					parent.layer.msg("操作成功");
				} else {
					parent.layer.alert(data.msg)
				}

			}
		});

	}

</script>

</body>
</html>
